<template>
  <div class="container">
    <!-- <transition name="router-fade" mode="out-in">
    <keep-alive>-->
    <router-view></router-view>
    <!-- <router-view v-if="$route.meta.keepAlive"></router-view> -->
    <!-- </keep-alive>
    	</transition>
    	<transition name="router-fade" mode="out-in">
			<router-view v-if="!$route.meta.keepAlive"></router-view>
    </transition>-->
    <!-- <svg-icon></svg-icon>	 -->
    <!-- <div>123</div> -->
  </div>
</template>

<script>
import { login, loginWeb } from "./service/getData";
import { setInterval } from 'timers';
export default {
  components: {
    // svgIcon
  },
  mounted() {
    this.login();
  },
  methods: {
    login: function() {
      loginWeb().then(res => {
        this.$store.userToken = res.token;
        // this.init();
      });

      // let code = this.GetUrlParam("code");

      // login(code).then(res => {
      //   this.$store.userToken = res.token;
      // });

      setInterval(() => {
        this.login();
      }, 29 * 60 * 1000);
    },

    GetUrlParam(paraName) {
      var url = document.location.toString();
      console.log("url: ", url);
      var arrObj = url.split("?");

      if (arrObj.length > 1) {
        var arrPara = arrObj[1].split("&");
        var arr;

        for (var i = 0; i < arrPara.length; i++) {
          arr = arrPara[i].split("=");

          if (arr != null && arr[0] == paraName) {
            return arr[1];
          }
        }
        return "";
      } else {
        return "";
      }
    }
  }
};
</script>

<style lang="scss">
@import "./style/common";
@import "./style/mixin";

// 字体设置
.container {
  @include sc(0.32rem, #000);
}
// .router-fade-enter-active,
// .router-fade-leave-active {
//   transition: opacity 0.3s;
// }
// .router-fade-enter,
// .router-fade-leave-active {
//   opacity: 0;
// }
</style>